package com.yt.project.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yt.project.common.BaseResponse;
import com.yt.project.common.ResultUtils;
import com.yt.project.mapper.BilibiliMapper;
import com.yt.project.mapper.DouyinMapper;
import com.yt.project.mapper.KuaishouMapper;
import com.yt.project.model.vo.AllCountVO;
import com.yt.project.service.BilibiliService;
import com.yt.project.service.DouyinService;
import com.yt.project.service.KuaishouService;
import com.yt.project.utils.SpringBeanUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("/all")
public class AllController {

    @Autowired
    private BilibiliService bilibiliService;

    @Autowired
    private DouyinService douyinService;


    @Autowired
    private KuaishouService kuaishouService;


    @PostMapping("/counts")
    public BaseResponse<AllCountVO> getAllCount() {
        long bilibiliCount = bilibiliService.count(new QueryWrapper<>());
        long douyinCount = douyinService.count();
        long kuaishouCount = kuaishouService.count();
        AllCountVO allCountVO = new AllCountVO();

        allCountVO.setBilibiliCount(bilibiliCount);
        allCountVO.setDouinCount(douyinCount);
        allCountVO.setKuaishouCount(kuaishouCount);
        return ResultUtils.success(allCountVO);
    }
}
